﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@Scripts.Render("~/bundles/login")

<h2>PEPe</h2>

@using (Html.BeginForm("Logar", "Login", FormMethod.Post, new { name = "frmLogin", id = "frmLogin", role = "form" }))
{

    <div>
        <div class="form-group">
            <label>E-mail:</label>
            <input type="text" id="login" name="login" />
            @Html.ValidationMessage("Login")
        </div>


        <div class="form-group">
            <label>Senha:</label>
            <input type="password" id="senha" name="senha" />
            @Html.ValidationMessage("Password")
        </div>
        <div class="form-group form-actions" style="padding-left:160px;padding-top:5px;">

            <input type="submit" class="btn btn-success" value="ok" />
        </div>
    </div>
    if (ViewBag.Erro != null)
    {
        @ViewBag.Erro
    }
}



<br />
<br />
<br />

@using (Html.BeginForm("Cadastrar", "Login", FormMethod.Post, new { name = "frmCadastrar", id = "frmCadastrar", role = "form" }))
{

    <div style="width:250px;">
        <div>
            <div>
                <label>Cadastre-se</label>
            </div>


            <div class="form-group">
                <label class="">Nome</label>
                <div class="">
                    <input type="text" class="form-control" id="Nome" name="Nome" value="" maxlength="255" />
                    @Html.ValidationMessage("Nome")
                </div>
            </div>

            <div class="form-group">
                <label class="">E-mail</label>
                <div class="">
                    <input type="text" class="form-control" id="Email" name="Email" value="" maxlength="255" />
                    @Html.ValidationMessage("Email")
                </div>
            </div>

            <div class="form-group">
                <label class="">Senha</label>
                <div class="">
                    <input type="password" class="form-control" id="Senha" name="Senha" value="" maxlength="255" />
                    @Html.ValidationMessage("Senha")
                </div>
            </div>

            <div class="form-group">
                <label class="">Confirmar Senha</label>
                <div class="">
                    <input type="password" class="form-control" id="ConfirmaSenha" name="ConfirmaSenha" value="" maxlength="255" />
                    @Html.ValidationMessage("ConfirmaSenha")
                </div>
            </div>

            <div class="form-group form-actions" style="text-align:right;padding-top:40px;">
                <div class="col-sm-offset-2 col-sm-10">
                    <a href="form.html" class="btn btn-default">Cancela</a>
                    <button type="submit" class="btn btn-success" value="ok">Registra</button>
                </div>
            </div>
        </div>
    </div>
}


<script>


    // Form validation Login
    $('#frmLogin').validate({
        rules: {
            "login": {
                required: true
            },
            "senha": {
                required: true
            },
        },
        highlight: function (element) {
            $(element).closest('.form-group').removeClass('success').addClass('error');
        },
        success: function (element) {
            element.addClass('valid').closest('.form-group').removeClass('error').addClass('success');
        }
    });

    // Form validation
    $('#frmCadastrar').validate({
        rules: {
            "Nome": {
                required: true
            },
            "Email": {
                required: true,
                email: true
            },
            "Senha": {
                required: true
            },
            "ConfirmaSenha": {
                required: true
            },
        },
        highlight: function (element) {
            $(element).closest('.form-group').removeClass('success').addClass('error');
        },
        success: function (element) {
            element.addClass('valid').closest('.form-group').removeClass('error').addClass('success');
        }
    });


    // Bootstrap wysiwyg
    $("#summernote").summernote({
        height: 240,
        toolbar: [
            ['style', ['style']],
            ['style', ['bold', 'italic', 'underline', 'clear']],
            ['fontsize', ['fontsize']],
            ['para', ['ul', 'ol', 'paragraph']],
            ['height', ['height']],
            ['insert', ['picture', 'link', 'video']],
            ['view', ['fullscreen', 'codeview']],
            ['table', ['table']],
        ]
    });

    // jQuery rating
    $('#raty').raty({
        path: 'images/raty',
        score: 4
    });

</script>
